<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        /*
        将其他类型转为string
        1 调用被转换类型的toString()方法
        2 调用String()函数,将被转换的数据作为参数传递给函数 对于null undefined 会直接将字面量转为字符串
        */
        var a = 123;
        a = a.toString();
        console.log(typeof a);

        var b = 344;
        b = String(b);
        console.log(typeof b);

        var c = null;
        c = String(c);
        console.log(typeof c);
        console.log(c);
    </script>
</head>
<body>
    
</body>
</html>